package com.qf.service.impl;

import com.qf.mapper.UserMapper;
import com.qf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service  // 还没扫描注解
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    @Transactional
    public void transferMoney(Integer outId, Integer inId, Integer money) {
        //1. 被借钱人 -钱
        userMapper.unaddMoney(outId,money);

        int i = 1 / 0;

        //2. 借钱人 +钱
        userMapper.addMoney(inId,money);
    }


}
